import java.awt.*;
import java.awt.geom.*;

/**
 * BomberBoy, CPS240 Term Project - Team A
 * Andrew Osterink, David Bash, Scott Kidder
 *
 * This class is linked with the entity manager and is in charge of any
 * object that makes an appearance in the game.  
 */

public abstract class Entity {
	/** X and Y locations of the entity */ 
	protected Point position;
	protected Point size;

	/** The sprite that represents this entity */
	protected Image texture;
	
	/** Horizontal and vertical speed */
	protected Point.Double velocity;
	
	/**Controls interaction with environment*/
	protected EntityManager manager; 

	/** Rectangles for collision detection, if needed*/
	protected Rectangle bounds = new Rectangle();
	
	/** Encapsulates collision */
	protected Collider<?> collider;
	/**
	 * Constructor
	 */
	public Entity() {
		velocity = new Point.Double();
		position = new Point();
		size = new Point();
		collider = new Collider<Entity>(this);
	
	}
	
    void setup(EntityManager mngr)
	{
		manager = mngr;
	}
    
    public void update(float dt) 
    {
    }
	
	
	
        //ACCESSOR & MUTATOR METHODS
	
	public Point2D.Double getVelocity()
	{
		return velocity;
	}
	
	public Point getPosition() {
		return position;
	}

	public Point getSize() {
		return size;
	}
	
	public void setPosition(Point pt)
	{
		setPosition(pt.x,pt.y);
	}
	
	public void setPosition(int x, int y)
	{
		position.x = x;
		position.y = y;
	}
	
	public void setSize(Point pt)
	{
		setSize(pt.x,pt.y);
	}
	
	public void setSize(int x,int y)
	{
		size.x = x;
		size.y = y;
	}
	

	public Rectangle getBounds()
	{
		return new Rectangle(bounds.x + position.x,bounds.y + position.y,bounds.width,bounds.height);
	}
	

	/**
	 * Draw this entity to the graphics context provided
	 * 
	 * @param g The graphics context on which to draw
	 */
	public void draw(Graphics2D g) {
		g.drawImage(texture, position.x, position.y, size.x,size.y,null);
	
	}
	
	public EntityManager getManager()
	{
		return manager;
	}
	

	

        
}